<!doctype html>
<html ng-app="baseDirective">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../../build/common/ngEdit.css" rel="stylesheet">
		<script type="text/javascript" src="../../build/common/ngEdit-ori.js"></script>
		<script type="text/javascript">
			var ComplateController = ['$scope','baseService',function(scope,baseService){
				scope.flowParam = window.passData;
				scope.flowParam.nodeUsers = {};
				scope.flowParam.nodeUsers[scope.flowParam.nodeId] = [{}];
				scope.userSet = scope.flowParam.nodeUsers[scope.flowParam.nodeId][0];
				scope.selectUser = function(){
					CustUtil.openCustDialog("userSelector", null, function(data) {
						angular.forEach(data, function(item) {
							//根据SysIdentity拼装对象
							var newUser = {
								id : item.id,
								name : item.name,
								type : "user"//用户
							};
							scope.$apply(function() {
								scope.userSet = scope.flowParam.nodeUsers[scope.flowParam.nodeId][0] = newUser;
							});
						});
					}, null, null, true);
				}
			}];
			
			function isValidate(){
				var flowParam = AngularUtil.getScope().flowParam;
				if (!flowParam.opinion) {
					$.Toast.warning("请填写意见！");
					return false;
				}
				if(!flowParam.nodeUsers[flowParam.nodeId][0].name){
					$.Toast.warning("请选择一位转交人！");
					return false;
				}
				return true;
			}
		</script>
	</head>
	<body class="panel success" ng-controller="ComplateController">
			<table class="form-table">
				<tr>								
					<th><span>备注:</span><span class="required">*</span></th>
					<td>
						 <textarea rows="2" cols="20" class="form-control" ng-model="flowParam.opinion"></textarea>
					</td>
				</tr>
				<tr>
					<th><span>转交人:</span><span class="required">*</span></th>
					<td>
						<span  ng-if="userSet.name">{{userSet.name}}</span>
						<a style="margin-left: 50px" class="btn btn-sm btn-primary fa-search" href="javascript:void(0)" ng-click="selectUser()">选择用户</a>
					</td>							
				</tr>
			</table>
	</body>
</html>